﻿using System;
using System.Collections.Generic;
using System.Text;

namespace FunctionalCLR.Core
{
    public class TanNode : FuncNode
    {
        public TanNode()
        {
            base.Value = "tan";
            this.ParameterCount = 1;
        }

        public override object Accept(IVisitor visitor)
        {
            return visitor.Visit(this);
        }

        public override FuncNode GetReversedFunction(int index)
        {
            return new CosNode();
        }

        public override object Evaluate()
        {
            double result = Convert.ToDouble(
                Children[0].Evaluate());

            return Math.Tan(result).ToString();
        }
    }
}
